package com.bite.rabbitmq.listener;


import com.bite.rabbitmq.constant.Constants;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class WorkListener {

    // 消费 queues 是表示消费那个队列的名称
    @RabbitListener(queues = Constants.WORK_QUEUE)
    public void listen1(Message message, Channel channel) {
        System.out.println("listen1 message: " + message + "\nchannel: " + channel);
    }

    @RabbitListener(queues = Constants.WORK_QUEUE)
    public void listen2(String message) {
        System.out.println("listen2 message(String): " + message);
    }
}
